﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class my_new_edit : AdminpageBase
{
    protected long id = ReadRequest.RequestLong("id");
    protected Model.LotteryQs model = new Model.LotteryQs();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            inidata();
        }
    }
    private void inidata()
    {
        model = BLL.LotteryQs.GetModel(id);
        if (model != null)
        {
            qstext.Text = model.Lotteryqs;
            control_date.Text = model.StartTime.ToString();
        }
    }

    //提交按钮事件
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        save_Newscont();
    }
    private void save_Newscont()
    {
        //获取登录信息
        Model.Manageadmin loginUserInfo_cur = BLL.CMember.ManageadminLoginInfo();
        //没有登录
        if (loginUserInfo_cur == null)
        {
            alertmessageAndGoback("保存失败");
            return;
        }
        Model.LotteryQs model = BLL.LotteryQs.GetModel(id);
        if (model != null)
        {
            model.Lotteryqs = qstext.Text;
            model.StartTime = Convert.ToDateTime(control_date.Text); 
            model.AddTime = DateTime.Now;

            if (BLL.LotteryQs.Update(model) > 0)
            {
                alertmessageAndGo("保存成功！", "/manage/LotteryQsReset.aspx");
                return;
            }
            else
            {
                alertmessageAndGoback("保存失败");
                return;
            }
        }
        else
        {
                alertmessageAndGoback("您的操作异常");
                return;
        }
    }
}